#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int isBD(char c){
	if(c=='?')
	return 1;
	if(c=='!')
	return 1;
	if(c==' ')
	return 1;
	if(c=='.')
	return 1;
	if(c==',')
	return 1;
	return 0;
}
int main(){
	char s[100],c;
	int i=0;
	c=getchar();
	while(c!='\n'){
		s[i++]=c;
		c=getchar();
	}
	s[i]='\0';
	i=0;
	while(s[i]!='\0'){
		while(isBD(s[i])==1&&s[i]!='\0')
		i++;
		int m=i;
		while(isBD(s[i])==0&&s[i]!='\0')
		i++;
		int k=i-1;
		while(m<k){
			char a=s[m];
			s[m]=s[k];
			s[k]=a;
			k--;
			m++;
		}
	}
	for(int j=0;s[j]!='\0';j++)
	cout<<s[j];
	cout<<endl;
	return 0;
}
